package com.lwj.liwanjia.adapter;


import android.content.Context;


import com.amap.api.services.core.PoiItem;
import com.lwj.liwanjia.R;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;


/**
 * Created by Administrator on 2017/9/14.
 */

public class AmapAdapter extends SuperBaseAdapter<PoiItem> {
    private int checkPosition;

    public AmapAdapter(Context context, List<PoiItem> data) {
        super(context, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, PoiItem item, int position) {
        holder.setText(R.id.text_name, item.getSnippet())
                .setText(R.id.text_address, item + "");
        if (checkPosition == position) {
            holder.setVisible(R.id.image, true);
        } else {
            holder.setVisible(R.id.image, false);
        }
    }

    @Override
    protected int getItemViewLayoutId(int position, PoiItem item) {
        return R.layout.address_poiitem;
    }

    public void setCheckPosition(int checkPosition) {
        this.checkPosition = checkPosition;
    }
}
